import logging,HTMLTestRunner_cn,yamail

class Tools:
    def log(self):
        log = logging.basicConfig(
            level=logging.DEBUG,
            filename=r'E:\gg4\PythonProject1\month\mail_163\log/youxiang.log',
            filemode='a+',
            format='%(levelname)s-%(filename)s-%(asctime)s-%(message)s-%(lineno)d'
        )
        return log

    def report(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(
            open(r'E:\gg4\PythonProject1\month\mail_163\report/youxiang.html', 'wb'),
            title='163邮箱测试报告',
            description='163邮箱的自动化测试'
        )
        return report

    def mail(self):
        mail = yamail.SMTP(user='3080172040@qq.com',password='abhdfnpkqkmadgff',host='smtp.qq.com')
        mail.send(
            to='3080172040@qq.com',
            subject='163邮箱系统Web Ui自动化测试报告',
            contents=[
                '163邮箱系统Web Ui自动化测试报告',
                r'E:\gg4\PythonProject1\month\mail_163\log/youxiang.log',
                r'E:\gg4\PythonProject1\month\mail_163\report/youxiang.html']
        )
        mail.close()